<template>
    <div class="check"
         v-loading="loading"
         element-loading-text="拼命加载中"
         element-loading-spinner="el-icon-loading"
         element-loading-background="rgba(255, 255, 255, 0.5)">
        <dialog-invoice :invoiceData="invoiceData"  @closeDialog="closeDialog"></dialog-invoice>
    </div>
</template>

<script>
    import DialogInvoice from '../../components/dialogModel/Invoice.vue';
    export default {
        name: 'invoice-detail',
        props: {
            params: {
                type: Object,
                default: () => {
                    return {}
                }
            },
            value: {
                type: String,
                default: ''
            }
        },
        components: {
            DialogInvoice
        },
        data() {
            return {
                loading:false,
                invoiceData: {}
            }
        },
        watch: {
        },
        computed: {
            id: function (value) {
                return this.params.id
            }
        },
        created() {
            this.getStatisticsData();
        },
        methods: {
            closeDialog(){
                this.$emit('closeDialog');
            },
            getStatisticsData() {
                this.loading = true;
                this.$http.get('money/invoice/' + this.id)
                    .then((response) => {
                        this.invoiceData = response.data.data;
                        this.loading = false;
                    })
                    .catch((error) => {
                        this.loading = false;
                        if (error.response.data.msg) {
                            this.$message.error(error.response.data.msg);
                        } else {
                            this.$message.error('请求错误：' + error.response.status);
                        }
                    });
            }
        }
    }
</script>

<style scoped>

</style>
